<?php

class Application_Form_Fill extends Application_Form_Basic
{

    public function init()
    {
        $this ->setMethod ( 'post' );
        
        $this->addElement(
            'hidden', 
            'id', 
            array(
                'value' => null
            )
        );
        
		$this->addElement ( 
            'text', 
            'name', 
            array ( 
                'label' => 'Назва :',
                'required' => true,
                'validators' => array(
                    array ('NotEmpty', true, 
                        array (
                            'messages' => array (
                                'isEmpty' => 'Поле не може бути пустим!' 
                            )
                        ) 
                    ),
                    array('stringLength', false, array(1, 180)),
                    array('Db_NoRecordExists', false, array(
                        'table' => 'price_fills', 
                        'field' => 'name'
                    ))
                )
            )
        );
        
        $this->addDisplayGroup(
			array( 'name' ),
			'name_group'
		);
        
        $group = $this->getDisplayGroup ('name_group');
        $group->removeDecorator ('DtDdWrapper');
        
        $this->addElement ( 
            'text', 
            'fill_color', 
            array ( 
                'label' => 'Колір :',
                'required' => true,
                'id' => 'systemColorPicker'
            )
        );
        
        $this->addDisplayGroup(
			array( 'fill_color' ),
			'fill_color_group'
		);
        
        
        $group = $this->getDisplayGroup ('fill_color_group');
        $group->removeDecorator ('DtDdWrapper');
        
        $this->addElement('file', 'photos', array(
			'label' => 'Текстура :',
			'destination' => Application_Model_PathsService::getInstance()->get("temp"),
			'valueDisabled' => true,
			'Count' => array(1)
		));
        
        $this->addDisplayGroup(
			array( 'photos' ),
			'photos_group'
		);
        
        
        $group = $this->getDisplayGroup ('photos_group');
        $group->removeDecorator ('DtDdWrapper');
        
        $this->addElement ( 
            'text',
            'price',
            array ( 
                'label' => 'Ціна :',
                'required' => true,
                'validators' => array(
                    array('Float', false)
                )
            )
        );
        
        $this->addDisplayGroup(
			array( 'price' ),
			'price_group'
		);
        
        $group = $this->getDisplayGroup ('price_group');
        $group->removeDecorator ('DtDdWrapper');
        
        $this->addElement ( 
            'text', 
            'cost', 
            array ( 
                'label' => 'Собівартість:',
                'required' => true,
                'validators' => array(
                    array('Float', false)
                )
            )
        );
        
        $this->addDisplayGroup(
			array( 'cost' ),
			'cost_group'
		);
        
        $group = $this->getDisplayGroup ('cost_group');
        $group->removeDecorator ('DtDdWrapper');
        
        $this->addElement (
            'submit', 
            'submit', 
            array (
                'ignore' => true, 
                'label' => 'Добавити' 
            ) 
        );
        
        $this->addDisplayGroup(
			array( 'submit' ),
			'buttos_group',
            array(
                'class' => 'group_buttons'
            )
		);
        
        $group = $this->getDisplayGroup ('buttos_group');
        $group->removeDecorator ('DtDdWrapper');
    }
}

